<script setup lang="ts">
import { ref } from "vue";
import Multiple from "@/views/common/multiplePic.vue"
import uploadFile from "@/views/common/uploadFile.vue"
import { formRules } from "./utils/rule";
import axios from "axios";
import {downloadByData} from "@pureadmin/utils";
// 声明 props 类型
export interface FormProps {
  formInline: {

  };
}
const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({  })
});

const onDownload = (uploadFile) => {
  axios.get(uploadFile.url, {responseType: "blob"}).then(({ data }) => {
      downloadByData(data, uploadFile.name);
  });
};

const newFormInline = ref(props.formInline);
const handleClose = (tag: string) => {
  newFormInline.value.selectOrders.splice(newFormInline.value.selectOrders.indexOf(tag), 1)
}
const ruleFormRef = ref();
function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });
</script>
<template>
  <el-form :model="newFormInline" ref="ruleFormRef" :rules="formRules" label-width="90px" size="small">
    <el-form-item label="实物图片" prop="entity_pic">
      <Multiple v-model="newFormInline.entity_pic" name="file" :isadd="newFormInline.title =='新增'" clearable :limit="15"  :disabled="newFormInline.title !='新增'"/>
    </el-form-item>
    <el-form-item label="实物尺寸" prop="size_pic">
      <Multiple v-model="newFormInline.size_pic" name="file" clearable :limit="15" :isadd="newFormInline.title =='新增'" :disabled="newFormInline.title !='新增'"/>
    </el-form-item>
    <el-form-item label="说明书" prop="file_ids">
      <uploadFile v-model="newFormInline.file_ids" :file-list="newFormInline.file_ids" name="file" clearable :limit="15"  :disabled="newFormInline.title !='新增'"/>
    </el-form-item>
    <el-form-item label="备注信息">
      <el-input v-model="newFormInline.remark" :disabled="newFormInline.title !='新增'" type="textarea" class="!w-[220px]" placeholder="请输入备注信息"/>
    </el-form-item>
    <el-form-item label="拍摄员" v-if="newFormInline.title !='新增'">
      <el-input v-model="newFormInline.upload_user" disabled class="!w-[220px]"/>
    </el-form-item>
    <el-form-item label="拍摄时间" v-if="newFormInline.title !='新增'">
      <el-input v-model="newFormInline.upload_at" disabled class="!w-[220px]" />
    </el-form-item>
  </el-form>
</template>

